Skip to content

Conversation

@paris3200
Copy link
Owner

Summary

Adds comprehensive test coverage for user-defined template variables to ensure the extensible template system works correctly.

Changes

  • Config test: Verifies user template variables merge properly with defaults
  • Integration test: Ensures config-defined template variables work in actual substitution
  • Override test: Confirms custom variables can override config variables
  • Coverage: Tests both function and static value template variables

Test Cases Added

  1. merges user-defined template variables with defaults - Tests that user variables are properly merged while preserving defaults
  2. uses config-defined template variables - Integration test that config variables work in template substitution
  3. overrides config variables with custom vars parameter - Tests precedence of custom vars over config vars

Why This Matters

This ensures the plugin's extensible template system works as documented, giving users confidence they can add custom variables like:

require("markdown-notes").setup({
  template_vars = {
    author = function() return "Your Name" end,
    project = function() return vim.fn.getcwd():match("([^/]+)$") end,
  },
})

All tests pass ✅

- Add config test for merging user template variables with defaults
- Add integration test for config-defined template variables in substitution
- Add test for custom variable override behavior
- Verify both function and static value template variables work correctly
@paris3200 paris3200 merged commit a10192a into develop Jul 7, 2025
3 checks passed
@paris3200 paris3200 deleted the test-user-template-vars branch July 7, 2025 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants